home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
X-Demos and Utilities
/
(c)x2.d64
/
chred.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
157 lines
5 PRINT"[147]CHARACTER EDITOR":PRINT"BY ANDY FINKEL":PRINT"(C)1982 BY COMMODORE"
6 IFFLTHEN102
10 PRINT"COPYING...":POKE52,32:POKE56,32:CLR:FORI=0TO15:READA$:NEXT
40 FORI=0TO107:READA:POKEI+12*4096,A:NEXT:SYS12*4096+3*16+8
100 CO$=CHR$(13)+"* [157][145][147]ENMXCTSALR+-[134]BQFO"+CHR$(148)+CHR$(20):NA$=" "
105 DEFFNA(I)=((N*8+Y-(X>7)*16+I)AND511)+D
107 DEFFND(I)=INT((IAND63)/20)*40+(IAND63)-INT((IAND63)/20)*20+56139
110 DEFFNB(J)=-((ZAND2^(7-J))>0)*42-((ZAND2^(7-J))=0)*32
125 POKE650,128:CL=55296:V=13*4096:Z$="[157][148] ":BL$=" ":L=0:POKEV+24,24
130 SC=1024:DA=SC+404:POKEV+22,PEEK(V+22)OR16
140 D=8704:N=0:AD=32:FL=1:F=0:L=0:K3=0
146 GOSUB770:POKEFND(0),0:GOTO492
180 CR=SC:X=0:Y=0
190 CS=PEEK(CR):POKECR,CSOR128
200 GETA$:IFA$=""THEN200
205 FORI=1TOLEN(CO$):IFMID$(CO$,I,1)<>A$THENNEXT:GOTO200
206 ONIGOTO550,530,520,580,590,600,610,540,570,560,490,430,450,231,221,251
207 ONI-16GOTO340,210,215,370,585,581,209,300,240,242,460,561,566
209 A=PEEK(V+33)+1:A=A+(A>15)*16:POKEV+33,A:GOTO190
210 DN=2:GOSUB690:GOSUB685:PRINT" $"B$:AD=VAL(LEFT$(B$,1))*16+VAL(MID$(B$,2,1)):GOTO190
215 DN=1:GOSUB690:GOSUB685:PRINT" "B$:NA$=B$+LEFT$(" ",6-LEN(B$))
216 OPEN1,8,12,B$+",P,R":GET#1,A$,A$:DN=9:FORI=FTOL:GOSUB685:PRINT""I" "
217 FORJ=0TO7:GOSUB685:GET#1,A$:IFST<>0THEN220
218 A=0:IFA$<>""THENA=ASC(A$)
219 POKE(J+D+I*8),A:NEXTJ,I
220 CLOSE1:GOSUB685:PRINTBL$:GOSUB630:GOTO190
221 DN=5:GOSUB901:FORI=0TO1:FORJ=0TO1:POKE55477+J+I*40,CORK3:NEXT:NEXT
222 PRINT" "A$:DN=6:A=34:GOSUB901:POKEV+A,C:PRINT" "A$
225 DN=7:A=35:GOSUB901:POKEV+A,C:PRINT" "A$:GOTO190
231 DN=8:GOSUB685:PRINTBL$:GOSUB765:IFA$="YES"THENK2=3
232 IFA$="NO "THENK2=0
234 FORI=0TO3:POKEFND(N+I),1:NEXT:GOSUB960:T=N:DN=0:GOTO491
240 POKE650,0:END
242 DN=9:GOSUB685:PRINT"[157][157][157][157][157]ALL? ";:GOSUB765:IFA$="YES"THENJ=0:K=511:A=0:GOTO245
243 GOSUB685:PRINTBL$:GOSUB685:PRINT"[157][157][157][157][157]CHR#";:GOSUB690:A=VAL(B$)AND255
244 J=N*8:K=7
245 FORI=0TOK:POKEJ+I+D,PEEK(A*8+I+8192):NEXT
246 GOSUB685:PRINT"[157][157][157][157][157] "BL$:GOSUB630:GOTO190
251 DN=4:GOSUB690:K=PEEK(55477)AND7:T$="HIRES":IFA$="M"THENT$="MULTI":K=KOR8
252 FORI=0TO1:FORJ=0TO1:POKE55477+I*40+J,K:NEXT:NEXT
253 K3=KAND8:GOSUB685:PRINT" "T$:GOTO190
300 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",S,W"
305 DN=9:FORI=FTOL:GOSUB685:PRINT""I" "
310 A$=".BYT":FORK=0TO7:A$=A$+STR$(PEEK(K+D+I*8))+",":NEXT
320 A$=LEFT$(A$,LEN(A$)-1)+" ;CHAR"+STR$(I)
330 PRINT#1,A$:NEXT:PRINT#1,".END":CLOSE1:GOSUB685:PRINTBL$:GOTO190
340 DN=1:GOSUB690:NA$=B$:GOSUB685:PRINT" "B$:OPEN1,8,12,B$+",P,W"
350 PRINT#1,CHR$(0);CHR$(AD);:DN=9:FORI=FTOL:GOSUB685:PRINT""I" "
360 FORJ=0TO7:GOSUB685:PRINT#1,CHR$(PEEK(J+D+I*8));:NEXT:NEXT
365 PRINT#1:CLOSE1:GOSUB685:PRINTBL$:GOTO190
370 DN=3:GOSUB690:FORI=1TOLEN(B$):IFMID$(B$,I,1)<>":"THENNEXT
380 F=ABS(VAL(MID$(B$,1,I-1))):F=FAND63
385 L=ABS(VAL(MID$(B$,I+1))):L=LAND63
390 GOSUB685:PRINT""STR$(F)":"STR$(L):GOTO190
430 FORI=0TOK2:POKEFND(N+I),1:NEXT:N=(N+K2+1)AND63:DN=0:GOTO491
450 DN=9:GOSUB685:PRINT"[157][157][157][157][157]MOVE:";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
455 FORI=0TO7+K2*8:POKEN*8+I+D,PEEK(A*8+I+D):NEXT:GOSUB630:GOTO180
460 DN=9:GOSUB685:PRINT"[157][157][157][157][157]OR :";:GOSUB660:GOSUB685:PRINT"[157][157][157][157][157] "BL$
465 FORI=0TO7+K2*8:POKEN*8+I+D,PEEK(A*8+I+D)ORPEEK(N*8+D+I):NEXT:GOSUB630
466 GOTO180
490 FORI=0TO3:POKEFND(N+I),1:NEXT:DN=0:GOSUB660:N=AAND63
491 GOSUB685:PRINT"[159]"N"[157] ":FORI=0TOK2:POKEFND(N+I),0:NEXT
492 IFK2=3THENPOKE1205,N+64:POKE1245,N+65:POKE1206,N+66:POKE1246,N+67:GOTO499
493 POKE1205,N+64:POKE1245,32:POKE1206,32:POKE1246,32:GOTO499
499 GOSUB631:GOTO180
520 POKECR,32:POKEFNA(0),PEEK(FNA(0))AND(255-2^(7-(XAND7))):GOTO580
530 POKECR,42:POKEFNA(0),PEEK(FNA(0))OR(2^(7-(XAND7))):GOTO580
540 Y=0
550 X=0:GOTO620
560 X=0:FORY=0TO7+K2*8:POKEFNA(0),256+NOT(PEEK(FNA(0))):NEXT:GOSUB630:GOTO180
561 T=X:X=0:I=PEEK(FNA(0)):J=(IAND254)/2:K=(IAND1)*128:I=PEEK(FNA(16))
563 POKEFNA(0),J:IFK2=3THENPOKEFNA(16),K+(IAND254)/2
565 X=T:GOSUB630:GOTO190
566 T=X:X=0:I=PEEK(FNA(16)):J=(IAND127)*2:K=(K3=0)*(I>127):I=PEEK(FNA(0))
567 POKEFNA(0),(IAND127)*2+K:IFK2=3THENPOKEFNA(16),J
569 X=T:GOSUB630:GOTO190
570 X=0:FORY=0TO7+K2*8:POKEFNA(0),0:NEXT:GOSUB630:GOTO180
580 X=X-(X<(7-(K2=3)*8)):GOTO620
581 T=Y:FORY=T+1TO7-(K2=3)*8:POKEFNA(-1),PEEK(FNA(0))
582 IFK2=3THENPOKEFNA(15),PEEK(FNA(16))
583 NEXT:Y=7-(K2=3)*8:POKEFNA(0),0:IFK2=3THENPOKEFNA(16),0
584 Y=T:GOSUB630:GOTO190
585 T=Y:FORY=7-(K2=3)*8TOT+1STEP-1:POKEFNA(0),PEEK(FNA(-1))
586 IFK2=3THENPOKEFNA(16),PEEK(FNA(15))
588 NEXT:Y=T:POKEFNA(0),0:IFK2=3THENPOKEFNA(16),0
589 GOSUB630:GOTO190
590 X=X+(X>0):GOTO620
600 Y=Y+(Y>0):GOTO620
610 Y=Y-(Y<(7-(K2=3)*8))
620 CS=PEEK(CR):POKECR,CSAND127:CR=SC+X+Y*40:GOTO190
630 K1=1304
631 T=N:FORI=0TOK2:N=(T+I)AND63
632 K1=1304-(I=1)*320-(I=2)*8-(I=3)*328
635 A=N*8+D:POKE167,A-INT(A/256)*256:POKE168,INT(A/256):POKE169,K1AND255
640 POKE170,INT(K1/256):SYS12*4096:NEXT:N=T:RETURN
660 GOSUB690:A=VAL(B$):RETURN
685 PRINT"":IFDN>0THENFORKI=1TODN:PRINT"";:NEXT
686 PRINTTAB(31);:RETURN
690 GOSUB685:PRINTBL$:GOSUB685
695 B$="":PRINT" *[157]";
700 GETA$:IFA$=""THEN700
710 IFASC(A$)=13THENA$=LEFT$(B$,1):GOSUB685:PRINTBL$:RETURN
720 IFASC(A$)=20ANDLEN(B$)=0THEN700
730 IFASC(A$)=20THENB$=LEFT$(B$,LEN(B$)-1):PRINT" [157][157]*[157]";:GOTO700
740 IFLEN(B$)>4ORASC(A$)<31THEN700
750 B$=B$+A$:PRINT"[159]"A$"*[157]";:GOTO700
765 GOSUB690:A$="NO ":IFLEFT$(B$,1)="Y"THENA$="YES"
766 GOSUB685:PRINT" "A$:RETURN
770 PRINT"[147]":K2=0:GOSUB960
800 PRINT"";TAB(25)"[156] CHAR EDIT "Z$
801 PRINTTAB(25)"[159] CHR#: 0 "Z$
802 PRINTTAB(25)" NAME: "NA$" "Z$
804 PRINTTAB(25)" ADDR: $2000 "Z$
805 PRINTTAB(25)" RANG: 0: 0 "Z$
806 PRINTTAB(25)" TYPE: HIRES "Z$
807 PRINTTAB(25)" FORE: GRN "Z$
808 PRINTTAB(25)" MLT0: RED "Z$
809 PRINTTAB(25)" MLT1: YEL "Z$
810 PRINTTAB(25)" XPAN: NO "Z$
814 PRINTTAB(25);" "Z$
815 PRINTTAB(25)" 1[146][159] MOVE"
820 PRINTTAB(25);" 2[146][159] COLOR"
860 PRINTTAB(25);" 3[146][159] RANGE"
885 PRINTTAB(25)" 4[146][159] XPAND"
886 PRINTTAB(25)" 5[146][159] NEXT CHAR"
887 PRINTTAB(25)" 6[146][159] BYTE"
888 PRINT"------------------------- 7[146][159] TYPE"
889 PRINT" 1111111111 8[146][159] QUIT"
890 PRINT" 01234567890123456789 9[146][159] SAVE"
891 PRINT"------------------------- A[146][159] EDIT"
892 PRINTTAB(25)" B[146][159] LOAD"
893 PRINTTAB(25)" C[146][159] FONT"
894 PRINTTAB(25)" C[146][159] OR"
895 PRINTTAB(25)" F[146][159] ADDRESS[145][145][145][145][145]":J=63:FORI=0TO3
896 PRINTCHR$(13)MID$(STR$(I*20),2);:FORK=0TO19:J=J+1:IFJ<128THENPOKEI*40+K+1867,J
897 NEXT:NEXT:RETURN
901 GOSUB690:RESTORE:FORC=0TO15:READA$:IFA$<>LEFT$(B$,3)THENNEXT:RESTORE:FORC=0TOPEEK(V+A)AND15:READA$:NEXT
902 GOSUB685:RETURN
940 GETA$:IFA$=""THEN940
950 RETURN
960 PRINT"[159]";:FORI=0TO16:PRINT" ":NEXT
965 PRINT"";:K=7-(K2>0)*8:FORI=0TOK:FORJ=0TOK:PRINT"";:NEXT
970 PRINT""RIGHT$(STR$(IAND7),1):NEXT
980 PRINTLEFT$("ABCDEFGHABCDEFGH",K+2);:PRINT" ":RETURN
1000 DATA BLK,WHT,RED,CYN,PUR,GRN,BLU,YEL,ORN,BRN,RD2,GY1,GY2,GN2,BL2,GY3
1005 DATA 169 , 7 , 133 , 171 , 164 , 171 , 177 , 167 , 133 , 248
1006 DATA 160 , 7 , 165 , 248 , 57 , 48 , 192 , 240 , 4 , 169
1007 DATA 42 , 208 , 2 , 169 , 32 , 145 , 169 , 136 , 16 , 238
1008 DATA 56 , 165 , 169 , 233 , 40 , 133 , 169 , 165 , 170 , 233
1009 DATA 0 , 133 , 170 , 198 , 171 , 16 , 213 , 96 , 128 , 64
1010 DATA 32 , 16 , 8 , 4 , 2 , 1 , 120 , 169 , 1 , 141
1011 DATA 13 , 220 , 169 , 51 , 133 , 1 , 160 , 255 , 185 , 0
1012 DATA 208 , 153 , 0 , 32 , 185 , 0,209,153,0,33
1013 DATA 185 , 0 , 212 , 153 , 0 , 36,185,0,213,153
1014 DATA 0 , 37 , 136 , 192 , 255 , 208 , 227 , 169 , 55 , 133
1015 DATA 1 , 169 , 129 , 141 , 13 , 220 , 88 , 96 , 255 , 0